<template>
	<page-body>
		<view class="page">
			<u-sticky :offsetTop="0">
				<view class="benben-position-layout" style="background-color: #fff;">
					<view class="flex  flex flex-wrap align-center mance_flex_0"
						:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
						<view class='flex flex-wrap align-center justify-between flex-sub mance_fd0_0'>
							<view class='flex flex-wrap align-center mance_fd0_0_c0'>
								<text class='fu-iconfont2  mance_fd0_0_c0_c0' @tap.stop="handleJumpDiy" data-type="back"
									data-url="1">&#xE794;</text>
							</view>
							<view class='flex flex-wrap align-stretch justify-center'>
								<text class='mance_fd0_0_c1_c0'>{{overviewObj.title}}</text>
							</view>
							<view @tap.stop="goNext"
								style="width: 128rpx;font-weight: 500;font-size: 32rpx;color: #395EFA;"
								class='flex flex-wrap align-center justify-end mance_fd0_0_c0'>
								<text>学习统计</text>
							</view>
						</view>
					</view>
					<view>
						<benben-flex-tabs class-name='coursePro_benbenTabsfd2_1_c0' v-model="tabsVal"
							ref="benben_tabsfd2_1_c0" select-mark="benben_tabsfd2_1_c0" key="benben_tabsfd2_1_c0"
							:open-title-type='false' :open-sticky='false' :top='0' :is-show-content='false'
							:scrollspy='false' :tabs-info.sync="tabsInfofd2_1_c0" >
              <!-- @change="getjf6f236d491017Func()" -->
							<scroll-view @scroll="tabsInfofd2_1_c0.scrollX = $event.detail.scrollLeft"
								id="benben_tabsfd2_1_c0" class="benben-tabs" style="width:700rpx" :scroll-x="true"
								:scroll-left="tabsInfofd2_1_c0.moveX" scroll-with-animation="all .3s ease">
								<view class="benben-tabs-content" id="benben_tabsfd2_1_c0-content">
									<view id="benben_tabsfd2_1_c0-title"
										class="benben-tabs-title flex align-center justify-around flex ">
										<view v-for="(item, key0) in tabs" :key="item.value" :class="[
								    tabsVal == item.value ? 'checkTitlefd2_1_c0' : 'checkTitlefd2_1_c0-other',
								    'flex flex-wrap align-center'
								  ]" :id="`benben_tabsfd2_1_c0-title-item-${item.value}`">
											<div @click="tabChange(item.value)">
												{{ item.name }}
											</div>
										</view>
									</view>
									<view
										:style="{ left: tabsInfofd2_1_c0.lineleft, maxWidth: tabsInfofd2_1_c0.lineWidth ,}"
										id="benben_tabsfd2_1_c0-line"
										class="benben-tabs-line flex benben-flex-tabs-line coursePro_linefd2_1_c0"
										:class="{'benben-tabs-line-active':tabsInfofd2_1_c0.isInit}"></view>
								</view>
							</scroll-view>
						</benben-flex-tabs>
					</view>
				</view>
			</u-sticky>

			<view :style="{height: (88+96+StatusBarRpx)+'rpx'}"></view>
			<view class="">
				<!-- 概览 -->
				<view v-if="tabsVal == 1" class="overview">
					<view class="overview-title">
						<view class="title1">
							{{overviewObj.title}}
						</view>
						<view class="title2">
							{{overviewObj.en_name}}
						</view>
					</view>

					<view class="describe">
						描述：{{overviewObj.content }}
					</view>


					<view class="cognition">
						<image style="flex-shrink: 0" src="@/static/img02/6.png" alt="" srcset="" />
						<view class="cognition-right">
							<view class="title-1">
								认知维度
							</view>
							<view v-if="overviewObj.range_type_name" class="tag" style="background-color: #145EFD;">
								{{overviewObj.range_type_name }}
							</view>
						</view>
					</view>
					<view class="cognition">
						<image style="flex-shrink: 0" src="@/static/img02/7.png" alt="" srcset="" />
						<view class="cognition-right">
							<view class="title-1">
								知识分类
							</view>
							<view v-if="overviewObj.knowledgecategory_name" class="tag" style="background-color: #FD762E;">
								{{overviewObj.knowledgecategory_name}}
							</view>
						</view>
					</view>
					<view class="cognition" style="border: none;">
						<image style="flex-shrink: 0" src="@/static/img02/8.png" alt="" srcset="" />
						<view class="cognition-right">
							<view class="title-1">
								教学目标
							</view>
							<div v-if="overviewObj.objective && overviewObj.objective.length"
								style="display: flex;flex-wrap: wrap;">
								<view v-for="(item , index) in overviewObj.objective" :key="index" class="tag"
									style="background-color: #31AEDB;margin-right: 10rpx;">
									{{item.name }}
								</view>
							</div>
              <view class="tag" v-else
              	style="background-color: #31AEDB;margin-right: 10rpx;">
              	暂无
              </view>
						</view>
					</view>
				</view>

				<!-- 知识点关系 -->
				<view v-if="tabsVal == 2" class="overview">
					<view class="overview-title">
						<view class="title1">
							{{overviewObj.title }}
						</view>
						<view class="title2">
							{{overviewObj.en_name}}
						</view>
					</view>
					<view class="cognition" style="margin-top: 32rpx;">
						<image src="@/static/img02/9.png" alt="" srcset="" />
						<view class="cognition-right">
							<view class="title-1">
								前置知识点({{linkObj.qianzhi_num}})
							</view>
							<div v-if="linkObj.qianzhi && linkObj.qianzhi.length"
								style="display: flex;flex-wrap: wrap;">
								<view v-for="(item ,index) in linkObj.qianzhi" :key="index" class="tag"
									style="background-color: #145EFD;">
									{{item.title_2}}
								</view>
							</div>
						</view>
					</view>
					<view class="cognition">
						<image src="@/static/img02/10.png" alt="" srcset="" />
						<view class="cognition-right">
							<view class="title-1">
								后置知识点({{linkObj.houzhi_num}})
							</view>
							<div v-if="linkObj.houzhi && linkObj.houzhi.length" style="display: flex;flex-wrap: wrap;">
								<view v-for="(item ,index) in linkObj.houzhi" :key="index" class="tag"
									style="background-color: #FD762E;">
									{{item.title_2}}
								</view>
							</div>
						</view>
					</view>
					<view class="cognition" style="border: none;">
						<image src="@/static/img02/11.png" alt="" srcset="" />
						<view class="cognition-right">
							<view class="title-1">
								关联知识点({{linkObj.guanlian_num }})
							</view>
							<div v-if="linkObj.zhishidian && linkObj.zhishidian.length"
								style="display: flex;flex-wrap: wrap;">
								<view v-for="(item ,index) in linkObj.zhishidian" :key="index" class="tag"
									style="background-color: #31AEDB;margin-right: 10rpx;">
									{{item.title_2}}
								</view>
							</div>
						</view>
					</view>
				</view>
				<!-- 关联资源 -->
				<view v-if="tabsVal == 3" class="overview">
					<view class="overview-title">
						<view class="title1">
							{{overviewObj.title}}
						</view>
						<view class="title2">
							{{overviewObj.en_name}}
						</view>
					</view>

					<view class="resources-outer">
						<view @click="goLook(item)" class="resources-item" v-for="(item,index) in sourceList"
							:key="index">
							<image :src="item.cover" class="item-img"></image>
							<view class="title">
								{{item.resource_name}}
							</view>
							<view class="jindu">
								学习进度 <span>{{item.progress}}%</span>
							</view>
							<view class="type">
								{{item.file_type}}
							</view>
						</view>
					</view>


				</view>

				<!-- 关联习题 -->
				<view v-if="tabsVal == 4" class="overview">
					<view class="overview-title">
						<view class="title1">
							{{overviewObj.title}}
						</view>
						<view class="title2">
							{{overviewObj.en_name}}
						</view>
					</view>

					<view class="short-answer" v-for="(item ,index) in exercisesList" :key="index">
						<view class="ti">
							<span>{{item.examquestions_type_name}}</span>
							第{{index+1}}题
						</view>
						<view class="content" v-html="item.question_title">
							<!-- {{item.question_title}} -->
						</view>
						<div class="select-outer" v-if="item.options">
							<div class="select-item flex" v-for="(item2 ,index) in item.options ">
                <text v-html="item2.label"></text>
                <text v-html="item2.value" class="margin-left"></text>
								<!-- {{item2.label}} {{item2.value}} -->
							</div>
						</div>
					</view>

				</view>
			</view>

		</view>
	</page-body>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"tabsInfofd2_1_c0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0,
					isInit: false
				},
				"tabs": [{
					"name": "概览",
					"value": "1",
					"image": ""
				}, {
					"name": "知识点关系",
					"value": "2",
					"image": ""
				}, {
					"name": "关联资源",
					"value": "3",
					"image": ""
				}, {
					"name": "关联习题",
					"value": "4",
					"image": ""
				}],
				"tabsVal": "1",
				"overviewObj": {},
				"linkObj": {},
				"sourceList": [],
				"exercisesList": [],
				"aid": "",
        kcid:''
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.aid = options.aid
      this.kcid = options.kcid
		},
		mounted() {
			this.get_examkeypointsApi()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.get_pointskeyresourceApi()
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			async goLook(val) {
				if (val.file_type == 'video') {
					uni.navigateTo({
						url: `/pages/course/scourseStudy/scourseStudy?url=${val.file_path[0].path}&file_type=${val.file_type}&aid=${val.freecourseresourcelibrary_id}&rate=${val.progress}`
					})
				} else {
					let res = await this.$api.post(global.apiUrls.post680f48d5c8263, {
						freecourseresourcelibrary_id: val.freecourseresourcelibrary_id,
						duration: 100
					})

					window.open(val.resource_file_path);
				}
			},
			goNext() {
				uni.navigateTo({
					url: `/pages/course/studyTotal/studyTotal?aid=${this.aid}&kcid=${this.kcid}`
				})
			},
			tabChange(val) {
				this.tabsVal = val

				if (val == 1) {
					this.get_examkeypointsApi()
				} else if (val == 2) {
					this.get_pointskeytieApi()
				} else if (val == 3) {
					this.get_pointskeyresourceApi()
				} else if (val == 4) {
					this.get_examkeyquestionsApi()
				}
			},

			// 关联习题
			async get_examkeyquestionsApi() {
				let res = await this.$api.post(global.apiUrls.post68d10214d9c73, {
					knowledgepoints_id: this.aid,
				})

				console.log('cccccccccccccccc', res);

				if (res.data.code == 1) {
					this.exercisesList = res.data.data
				}
			},

			// 关联资源
			async get_pointskeyresourceApi() {
				let res = await this.$api.post(global.apiUrls.post68d0ed6a3173c, {
					knowledgepoints_id	: this.aid,
				})

				if (res.data.code == 1) {
					this.sourceList = res.data.data
				}
			},

			// 知识点关系
			async get_pointskeytieApi() {
				let res = await this.$api.post(global.apiUrls.post68d0b9487f5b9, {
					knowledgepoints_id: this.aid,
				})

				if (res.data.code == 1) {
					this.linkObj = res.data.data
				}
			},
			// 概览
			async get_examkeypointsApi() {
				let res = await this.$api.post(global.apiUrls.post68d0a0e309bec, {
					aid: this.aid,
				})

				if (res.data.code == 1) {
					this.overviewObj = res.data.data
				}
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;


	}

	.mance_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.mance_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.mance_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.mance_fd0_0_c0 {
		width: 120rpx;
	}

	.mance_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.overview {
		min-height: 1000rpx;
		background-color: #fff;
		width: 100%;
		height: 100%;
		padding: 0 24px;
		overflow-y: auto;
		padding-bottom: 50rpx;

		.describe {
			font-weight: 400;
			font-size: 26rpx;
			color: #747E96;
			line-height: 37rpx;
			margin-top: 32rpx;
			margin-bottom: 48rpx;
		}

		.overview-title {
			width: 100%;
			height: 140rpx;
			background-image: url('@/static/img02/05.png');
			background-size: 100% 100%;
			background-repeat: no-repeat;
			margin-top: 36rpx;
			overflow: hidden;

			.title1 {
				font-weight: 500;
				font-size: 28rpx;
				color: #131D34;
				line-height: 40rpx;
				margin: 26rpx 0 0 24rpx;
			}

			.title2 {
				font-weight: 400;
				font-size: 24rpx;
				color: #131D34;
				line-height: 33rpx;
				margin: 16rpx 0 0 24rpx;
			}
		}

		.short-answer {
			background: #FFFFFF;
			box-shadow: 0rpx 0rpx 9rpx 1rpx rgba(0, 18, 80, 0.06);
			border-radius: 12rpx 12rpx 12rpx 12rpx;
			border: 1rpx solid #EEEEEE;
			margin-top: 20rpx;
			padding: 32rpx 24rpx 36rpx;

			.ti {
				font-weight: 500;
				font-size: 28rpx;
				color: #131D34;
				line-height: 29rpx;

				span {
					font-weight: 400;
					font-size: 24rpx;
					color: #FFFFFF;
					line-height: 33rpx;
					padding: 4rpx 16rpx;
					background-color: #145EFD;
					border-radius: 8rpx;
					margin-right: 16rpx;
				}
			}

			.content {
				font-weight: 400;
				font-size: 26rpx;
				color: #131D34;
				line-height: 37rpx;
				margin-top: 36rpx;
			}

			.select-item {
				font-weight: 400;
				font-size: 26rpx;
				color: #131D34;
				line-height: 37rpx;
				margin-top: 24rpx;
			}
		}

		.resources-outer {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;

			.resources-item {
				width: 49%;
				height: 356rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 3rpx 9rpx 1rpx rgba(0, 18, 80, 0.06);
				border-radius: 12rpx 12rpx 12rpx 12rpx;
				margin-top: 20rpx;
				position: relative;

				.item-img {
					width: 340rpx;
					height: 192rpx;
					border-radius: 16rpx 16rpx 0rpx 0rpx;
				}

				.type {
					width: 105rpx;
					height: 43rpx;
					position: absolute;
					top: 0;
					right: 0;
					font-weight: 400;
					font-size: 20rpx;
					color: #FFFFFF;
					line-height: 30rpx;
					text-align: center;
					background-image: url("@/static/img02/typebj.png");
					background-size: 105rpx 43rpx;
					background-repeat: no-repeat;
				}

				.title {
					width: 296rpx;
					height: 80rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #131D34;
					line-height: 39rpx;
					text-align: left;
					font-style: normal;
					text-transform: none;
					margin-top: 16rpx;
					margin-left: 20rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;

				}

				.jindu {
					font-weight: 400;
					font-size: 24rpx;
					color: #747E96;
					line-height: 33rpx;
					margin: 0 20rpx;

					span {
						font-weight: 400;
						font-size: 24rpx;
						color: #31CA91;
						margin-left: 12rpx;
					}
				}
			}
		}

		.cognition {
			display: flex;
			margin-left: 12rpx;
			padding-bottom: 32rpx;
			border-bottom: 1rpx solid #EEEEEE;
			margin-bottom: 32rpx;

			image {
				width: 36rpx;
				height: 36rpx;
			}

			.cognition-right {
				margin-left: 12rpx;

				.title-1 {
					font-weight: 500;
					font-size: 28rpx;
					color: #131D34;
					line-height: 40rpx;
				}

				.tag {
					margin-top: 24rpx;
					font-weight: 400;
					font-size: 24rpx;
					color: #FFFFFF;
					line-height: 33rpx;
					padding: 12rpx 30rpx;
					border-radius: 12rpx;
					width: fit-content;
				}
			}
		}

	}



	//------------
	.coursePro_flex_0 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 12;
		top: 0rpx;
		background: #fff;
	}

	.coursePro_flex_0123456 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 12;
		top: 0rpx;
		// background: #145efd;
	}

	.coursePro_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.coursePro_fd0_0_c0_c00012 {
		font-size: 36rpx;
		color: #333;
	}

	.coursePro_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: var(--benbenFontColor3);
	}

	.coursePro_fd0_0_c0 {
		width: 120rpx;
	}

	.coursePro_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.coursePro_flex_1 {
		height: 524rpx;
		margin: -150rpx 0rpx 0rpx 0rpx;
	}

	.coursePro_fd1_0 {
		width: 100%;
		height: 100%;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.coursePro_flex_2 {
		position: relative;
	}

	::v-deep .coursePro_fd2_2_c1_c0 {
		width: 100%;
	}

	.coursePro_fd2_2_c1 {
		padding: 32rpx 24rpx 32rpx 024rpx;
	}

	.coursePro_fd2_2_c0_c0_c4 {
		background: rgba(20, 94, 253, .1);
		border-radius: 33rpx 33rpx 33rpx 33rpx;
		width: 123rpx;
		height: 56rpx;
		line-height: 56rpx;
		font-size: 24rpx;
		color: rgba(20, 94, 253, 1);
		margin-top: -55rpx;
	}

	.coursePro_fd2_2_c0_c0_c3 {
		background: #145efd;
		border-radius: 33rpx 33rpx 33rpx 33rpx;
		width: 123rpx;
		height: 56rpx;
		line-height: 56rpx;
		font-size: 26rpx;
		margin-top: -55rpx;
		color: var(--benbenFontColor3);
	}

	.coursePro_fd2_2_c0_c0_c2 {
		width: 123rpx;
		height: 56rpx;
		line-height: 56rpx;
		border-radius: 28rpx;
		border: 1rpx solid #949AAB;
		font-weight: 400;
		font-size: 26rpx;
		margin-top: -55rpx;
		color: #949AAB;
	}

	.coursePro_fd2_2_c0_c0_c1_c1_c1 {
		color: rgba(153, 153, 153, 1);
		font-size: 24rpx;
		font-weight: 400;
	}

	.coursePro_fd2_2_c0_c0_c1_c1_c0 {
		width: 24rpx;
		height: 24rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.coursePro_fd2_2_c0_c0_c1_c0_c0 {
		margin: 0rpx 16rpx 0rpx 0rpx;
		line-height: 42rpx;
		font-weight: 500;
		font-size: 28rpx;
		color: rgba(51, 51, 51, 1);
		width: 100%;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.coursePro_fd2_2_c0_c0_c1_c0 {
		width: 100%;
	}

	.coursePro_fd2_2_c0_c0_c1 {
		border-bottom: 1px solid #EEEEEE;
		height: 148rpx;
	}

	.coursePro_fd2_2_c0_c0_c0_c0 {
		margin: 1rpx 16rpx 0rpx 0rpx;
		line-height: 42rpx;
		font-weight: 500;
		font-size: 28rpx;
		color: rgba(51, 51, 51, 1);
	}

	.coursePro_fd2_2_c0_c0_c0 {
		height: 94rpx;
		font-weight: 500;
		font-size: 28rpx;
		color: #131D34;
	}

	.coursePro_fd2_2_c0_c0 {
		height: 148rpx;
	}

	.coursePro_fd2_2_c0 {
		padding: 0rpx 0rpx 0rpx 0rpx;
	}

	.coursePro_fd2_2 {
		background: var(--benbenbgColor1);
		padding: 0 24rpx 32rpx 24rpx;
		background-size: 100% auto;
		border-radius: 32rpx;
	}

	.coursePro_linefd2_1_c0 {
		background: rgba(20, 94, 253, 1);
		width: 104rpx;
		height: 4rpx;
		top: 87rpx;
		border-radius: 16rpx;
	}

	.checkTitlefd2_1_c0 {
		font-weight: 600 !important;
		font-size: 30rpx !important;
		color: #131D34 !important;
		background-color: rgba(255, 255, 255, 1) !important;
	}

	.checkTitlefd2_1_c0-other {
		font-weight: 400;
		font-size: 30rpx;
		color: #747E96;
	}

	::v-deep .coursePro_benbenTabsfd2_1_c0 {
		background: #fff;
		width: 100%;
		height: 100rpx;
		white-space: nowrap;
		text-align: center;
		display: flex;
		justify-content: space-around;
		border-bottom: 1rpx solid #EEEEEE;
		border-top: 8rpx solid RGBA(243, 244, 248, 1);
	}

	.coursePro_fd2_1 {
		height: 92rpx;
		background-color: #EEEEEE;
		border-bottom: 1rpx solid #EEEEEE;
	}

	.coursePro_fd2_0_c1_c3 {
		background: #999999;
		width: 1rpx;
		height: 30rpx;
		margin: 0rpx 16rpx 0rpx 16rpx;
		transform: scaleX(0.5);
	}

	.coursePro_fd2_0_c1_c0 {
		color: rgba(153, 153, 153, 1);
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.jilu-outer {
		margin: 44rpx 0;
		width: 100%;
		display: flex;
		justify-content: space-around;

		.jilu-item {
			display: flex;
			width: 100rpx;
			flex-direction: column;
			align-items: center;

			image {
				width: 56rpx;
				height: 62rpx;
				margin-bottom: 15rpx;
			}

			text {
				line-height: 33rpx;
				font-weight: 400;
				font-size: 24rpx;
				color: #131D34;
			}
		}
	}

	.coursePro_fd2_0_c0 {
		margin: 24rpx 0rpx 26rpx 0rpx;
		color: #333333;
		font-size: 34rpx;
		font-weight: 600;
		line-height: 45rpx;
	}

	.text1-outer {
		line-height: 37rpx;
		padding: 2rpx 20rpx;
		background: #E7EEFE;
		border-radius: 26rpx;
		font-size: 26rpx;
		color: #145EFD;
		margin-right: 10rpx;
	}

	.coursePro_fd2_0 {
		padding: 0 24rpx 0 24rpx;
		background-color: #fff;

	}

	.coursePro_flex_3 {
		width: 750rpx;
		height: 110rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		background-color: #fff;
	}

	.coursePro_fd3_0 {
		background: #145efd;
		width: 450rpx;
		height: 64rpx;
		line-height: 64rpx;
		font-size: 30rpx;
		color: #fff;
		border-radius: 44rpx;
		margin: 0 auto
	}
</style>